import * as types from './mutation-types'
let that = this
const mutations = {
  [types.changeToken](state, data) {
    //登录或者注册时，存储token的方法
    state.iflogin = data.iflogin
    state.username = data.username
    try {
      localStorage.iflogin = iflogin
    } catch (e) { }
  },
  [types.clearToken](state) {
    //退出登录时清除token的方法
    localStorage.iflogin = ''
    state.iflogin = ''
    state.username = ''
  },
  [types.changeRepairlist](state, data) {
    state.repairlist.push(data)
  },
  [types.changeMemorylist](state, data) {
    state.memorandumlist.push(data)
  },
  [types.changeChartlist](state, data) {
    state.chartlist = data.list
  },
  [types.changeRooms](state, data) {
    state.rooms = data.rooms
  },
  [types.changeMeetings](state, data) {
    state.meetings = data.meetings
  },
  [types.deleteMeetings](state, data) {
    state.meetings = state.meetings.filter((item) => {
      return item.ID != data.ID
    })
  },
  [types.updateMeetings](state, data) {
    console.log(data.ID)
    state.meetings.map((item) => {
      console.log(item.ID)
      if (item.ID == data.ID) {
        that.$set(item, "endTime", data.endTime)
        console.log(item)
      }
    })
  },
}


export default mutations